package com.yueyang.sojourn.server.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author andy.yang
 * @summary 退款单状态 枚举
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-02-29
 */
@AllArgsConstructor
public enum OrderRefundStatusEnum implements IEnum {
    /**
     * 订单状态 枚举
     */
    REFUNDING(10, "待退款"),
    REFUNDED(20, "已退款"),
    CLOSED(30, "已取消")
    ;

    @Getter
    private int code;

    @Getter
    private String desc;

    public static OrderRefundStatusEnum ofCode(Integer code) {
        return Arrays.stream(OrderRefundStatusEnum.values()).filter(operStatusEnum -> operStatusEnum.code == code).findFirst().orElse(null);
    }
}
